<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
      .tab {
          list-style: none;
      }

      .tab li {
         display: inline-block;
          border: 1px solid #000;
          background-color: aqua;
      }

      .tab li.active {
          background-color: gold;
      }

      img {
          width: 300px;
      }

      #app>div {
          display: none;
      }

      #app>.active {
          display: block;
      }
  </style>
</head>
<body>
  <div id="app">
      <ul class="tab">
          <li @click = "changeIndex(1)" :class="currentIndex==1? 'active' : ''">img1</li>
          <li @click = "changeIndex(2)" :class="currentIndex==2? 'active' : ''">img2</li>
          <li @click = "changeIndex(3)" :class="currentIndex==3? 'active' : ''">img3</li>
      </ul>

      <div :class="currentIndex==1? 'active' : ''"><img src="img/1.png" alt=""> </div>
      <div :class="currentIndex==2? 'active' : ''"><img src="img/2.png" alt=""> </div>
      <div :class="currentIndex==3? 'active' : ''"><img src="img/3.png" alt=""> </div>
  </div>
  <script src="./vue.js"></script>
  <script>
    var vm = new Vue({
      el:'#app',
      data:{
          currentIndex: 1
      },
      methods:{
          changeIndex(i) {
            this.currentIndex = i
          }
      }
     });
  </script>
</body>
</html>
